<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
*/

/**
* Description of RSSItem
*
* @author Sabonay
*/
class RSSItem {
//put your code here
var $title,$description,$link,$pubDate,$category;
var $guid=array(
"isPermaLink"=>"",
"link"=>""
);
var $media=array(
"width"=>"",
"height"=>"",
"fileloc"=>""
);

public function __construct($title,$description,$link,$pubDate) {
$this->title =$title;
$this->description =$description;
$this->link = $link;
$this->pubDate=$pubDate;
}
function buildRssItem()
{

if(strlen($this->pubDate)<1)
        $this->pubDate = date("D, d M Y H:i:s ");

        $this->title = htmlentities(strip_tags($this->title));
        $this->description = htmlentities(strip_tags($this->description));

$rssItem= "\t<title>".$this->title."</title>\n";
$rssItem.= "\t\t<description>".$this->description."</description>\n";
$rssItem.= "\t\t<link>".$this->link."</link>\n";
$rssItem.= "\t\t<pubDate>".$this->pubDate."</pubDate>\n";

if(strlen($this->guid['link'])>0)
$rssItem.= "\t\t<guid isPermaLink=\"".$this->guid["isPermaLink"]."\">".$this->guid["link"]."</guid>\n";


if(strlen($this->category)>0)
$rssItem.= "\t\t<category>".$this->category."</category>\n";

if(strlen($this->media['fileloc'])>0)
$rssItem.= "\t\t<media:thumbnail width=\"$this->media['width']\" height=\"$this->media['width']\" url=\"$this->media['fileloc']\"/>\n";
return "\n\t<item>\n\t".$rssItem."\t</item>\n";

}
}
?>
